<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/common.jsp" %>
<div class="pageContent">
	<form id="form" method="post" action="${ctxPath}/sys/sysRole/assignMenu" class="pageForm required-validate" onsubmit="return validateCallback(this, dialogAjaxDone);">
		<input type="hidden" name="navTabId" value="jsgl">
		<input type="hidden" name="callbackType" value="closeCurrent">
		<input type="hidden" name="roleId" value="${role.id }" />
		<input type="hidden" name="selectVal" id="selectVal" value="">
		<div class="pageFormContent" layoutH="60">
			${resourcesTree }
		</div>
		<div class="formBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="button"  onclick="submitForm()" >保存</button></div></div></li>
				<li><div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div></li>
			</ul>
		</div>
	</form>
</div>
<script type="text/javascript">
function submitForm() {
	var str = "";
	//获取所有的可以选择的资源
	$("input:checkbox[name=resourceName]").each(function(index) {
		//判断是否被选中
		if($(this).attr("checked")){
			str += $(this).val() + ",";
		}
	});
	//alert(str);
	if(str == null || str == ""){
		alertMsg.error("关联的权限不能为空!");
		return;
	}
	$("#selectVal").val(str);
	$("#form").submit();
}
</script>
